package com.peza.bikelog.common.domain.polar;

import com.peza.bikelog.common.util.Util;

public class HrmTrip implements Writable{

	private Util util = Util.getInstance();
	
	private int distance; 	// x10 kms
	private int ascent;
	private long totalTime;
	private int avgAlt;
	private int maxAlt;
	private int avgSpeed;
	private int maxSpeed;
	private int odometer;
	
	
	public HrmTrip(){
		
	}
	
	public HrmTrip(String data){
		
		String [] fields = data.split("\n");
		distance = util.convertToInt(fields[0]);
		ascent = util.convertToInt(fields[1]);
		totalTime = util.convertToInt(fields[2]);
		avgAlt = util.convertToInt(fields[3]);
		maxAlt = util.convertToInt(fields[4]);
		avgSpeed = util.convertToInt(fields[5]);
		maxSpeed = util.convertToInt(fields[6]);
		odometer = util.convertToInt(fields[7]);
		
	}
	
	
	
	public int getDistance() {
		return distance;
	}
	public void setDistance(int distance) {
		this.distance = distance;
	}
	public int getAscent() {
		return ascent;
	}
	public void setAscent(int ascent) {
		this.ascent = ascent;
	}
	public long getTotalTime() {
		return totalTime;
	}
	public void setTotalTime(long totalTime) {
		this.totalTime = totalTime;
	}
	public int getAvgAlt() {
		return avgAlt;
	}
	public void setAvgAlt(int avgAlt) {
		this.avgAlt = avgAlt;
	}
	public int getMaxAlt() {
		return maxAlt;
	}
	public void setMaxAlt(int maxAlt) {
		this.maxAlt = maxAlt;
	}
	public int getAvgSpeed() {
		return avgSpeed;
	}
	public void setAvgSpeed(int avgSpeed) {
		this.avgSpeed = avgSpeed;
	}
	public int getMaxSpeed() {
		return maxSpeed;
	}
	public void setMaxSpeed(int maxSpeed) {
		this.maxSpeed = maxSpeed;
	}
	public int getOdometer() {
		return odometer;
	}
	public void setOdometer(int odometer) {
		this.odometer = odometer;
	}

	@Override
	public String toFileString() {
		StringBuffer buffer = new StringBuffer("[Trip]\n");
		buffer.append(distance +"\n" + ascent +"\n" + totalTime + "\n");
		buffer.append(avgAlt +"\n" + maxAlt +"\n" + avgSpeed +"\n" + maxSpeed +"\n" + odometer +"\n");
		buffer.append("\n");
		return buffer.toString();
	}
			
			
	
	
	
}
